:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #222;
  --muted: #6b7280;
  --primary: #1677ff;
  --border: #e5e7eb;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
  color: var(--text);
  background: var(--bg);
}

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.page-header h1 {
  font-size: 20px;
  margin: 0;
}

.version-badge {
  font-size: 12px;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  padding: 16px;
  height: calc(100vh - 65px);
}

.sidebar {
  overflow: auto;
}

.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.panel-title {
  font-weight: 600;
  margin: 4px 0 12px 0;
}

.form-item {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.radio-group {
  display: flex;
  gap: 16px;
}

.radio-group label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.select,
.textarea,
.input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.select:focus,
.textarea:focus,
.input:focus {
  border-color: var(--primary);
}

.textarea {
  resize: vertical;
}

.button-row {
  display: flex;
  gap: 8px;
}

.btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn.primary:hover:not(:disabled) {
  opacity: 0.9;
}

.btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
}

.small {
  font-size: 12px;
  color: var(--muted);
}

.uploader-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.model-title {
  font-weight: 600;
}

.chat-body {
  flex: 1;
  overflow: auto;
  margin-top: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.preview-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fafafa;
}

.preview-card img {
  width: 100%;
  display: block;
}

.caption {
  font-size: 12px;
  color: var(--muted);
  padding: 6px;
}

.message {
  display: flex;
  gap: 10px;
}

.message--preview {
  flex-direction: column;
}

.msg-role {
  flex: 0 0 28px;
  font-size: 12px;
  color: var(--muted);
}

.msg-role.me {
  color: var(--primary);
}

.msg-content {
  flex: 1;
}

.chat-input {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 12px;
    height: auto;
  }
}

